﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ZLDC.Common.Estate;
using ZLDC.Topo.Model.Estate;
using ZLDC.Topo.BLL.Estate;

namespace ZLDC.Estate
{
                public class CacheHousing
    {
        #region 盘源详情

                                                public static string Cache_Detail_Json(int id)
        {
            string json = "";
            string cachekey = CacheConst.CACHE_HOUSING_DETAIL_JSON + id.ToString();

            if (_Cache.GetCache(cachekey) == null || _Cache.GetCache(cachekey).ToString() == "")
            {
                json = ZLDC.Topo.BLL.Estate.HousingBLL.p_housing_detail_table(id);
                _Cache.SetCache(cachekey, json, CacheConst.CACHE_HOUSING_DETAIL_JSON_TIME);
            }
            else
                json = _Cache.GetCache(cachekey).ToString();

            return json;
        }

                                                public static HousingInfo Cache_Detail_Info(int id)
        {
            HousingInfo info = null; 
            string cachekey = CacheConst.CACHE_HOUSING_DETAIL_INFO + id.ToString();

            if (_Cache.GetCache(cachekey) == null || _Cache.GetCache(cachekey).ToString() == "")
            {
                info = HousingBLL.p_housing_detail(id);
                _Cache.SetCache(cachekey, info, CacheConst.CACHE_HOUSING_DETAIL_INFO_TIME);
            }
            else
                info = (HousingInfo)_Cache.GetCache(cachekey);

            return info;
        }

        #endregion

        #region 降价盘查询

                                                                        public static string Cache_Reduction_Json(int page, int pagesize, int deptid, string condition)
        {
            string json = "";
            string cachekey = CacheConst.CACHE_HOUSING_REDUCTION + deptid.ToString();

            if (_Cache.GetCache(cachekey) == null || _Cache.GetCache(cachekey).ToString() == "")
            {
                json = ZLDC.Topo.BLL.Estate.PriceReductionBLL.p_v_priceReduction_list_table(page, pagesize, condition);
                _Cache.SetCache(cachekey, json, CacheConst.CACHE_HOUSING_REDUCTION_TIME);
            }
            else
                json = _Cache.GetCache(cachekey).ToString();

            return json;
        }

        #endregion

        #region 我的盘源


        #endregion

    }


}
